package com.aifast.common.base;

import com.aifast.common.dict.DictBind;
import com.aifast.common.dict.DictBindType;
import com.alibaba.excel.annotation.ExcelIgnore;
import com.alibaba.excel.annotation.ExcelProperty;
import com.baomidou.mybatisplus.annotation.*;

import java.io.Serializable;

/**
 * 雪花id 的基础实体类
 */
public class BaseSfEntity implements Serializable {

    private static final long serialVersionUID = -3165476653870867187L;
    /**
     * pk
     */
    @ExcelProperty("ID")
    @TableId(value = "id", type = IdType.ASSIGN_ID)
    private Long id;

    /**
     * 创建人
     */
    @DictBind(mode = DictBindType.JOIN, tableName = "sys_user", columns = "real_name", target = "createUserName")
    @ExcelProperty("创建人")
    @TableField(fill = FieldFill.INSERT)
    private Long createBy;
    /**
     * 创建时间
     */
    @ExcelProperty("创建时间")
    @TableField(fill = FieldFill.INSERT)
    private String createTime;
    /**
     * 更新人
     */
    @DictBind(mode = DictBindType.JOIN, tableName = "sys_user", columns = "real_name", target = "updateUserName")
    @ExcelProperty("更新人")
    @TableField(fill = FieldFill.INSERT_UPDATE)
    private Long updateBy;
    /**
     * 更新时间
     */
    @ExcelProperty("更新时间")
    @TableField(fill = FieldFill.INSERT_UPDATE)
    private String updateTime;
    /**
     * 逻辑删除
     */
    @ExcelIgnore
    @TableLogic
    private boolean deleted;

    /**
     * 关键字查询
     */
    @ExcelIgnore
    @TableField(exist = false)
    private String searchValue;

}
